package com.zdsoft.crm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.zdsoft.crm.dao.IContractMapper;
import com.zdsoft.crm.util.DateUtil;

@Controller
@RequestMapping("/contract")
public class ContractController extends BaseController {

	@Autowired
	IContractMapper mapper;

	@GetMapping
	public ModelAndView index() {
		ModelAndView mav = new ModelAndView("contract/index.html");
		String firstDayOfWeek = DateUtil.getFirstDayOfWeek().toString();
		String lastDayOfWeek = DateUtil.getLastDayOfWeek().toString();
		mav.addObject("countData", mapper.contractCount(firstDayOfWeek, lastDayOfWeek));
		return mav;
	}
}
